<?php

/**
 * Result form.
 *
 * @package    tests
 * @subpackage form
 * @author     Djul
 */
class ResultForm extends BaseResultForm
{
  public function configure()
  {
       $c = new Criteria();
    if(!sfContext::getInstance()->getUser()->getGuardUser()->getIsSuperAdmin())
    {
       $c->addJoin(TestPeer::TEST_BLOCK_ID, TestBlockPeer::ID);
       $c->addJoin(TestBlockPeer::SUBJECT_ID, UserSubjectPeer::SUBJECT_ID);
       $c->addJoin(UserSubjectPeer::USER_ID, sfContext::getInstance()->getUser()->getGuardUser()->getId());
    }

    $this->widgetSchema['user_id'] = new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => false, 'criteria' => $c));
    $this->validatorSchema['user_id'] = new sfValidatorPropelChoice(array('model' => 'sfGuardUser', 'column' => 'id', 'criteria' => $c));
   }
}
